package com.itheima.demo04;

import java.util.Random;

public class LambdaDemo {

    public static void main(String[] args) {

        useRandomNumHandler(new RandomNumHandler() {

            @Override
            public int getRandomNm() {
                Random r = new Random();
                int i = r.nextInt();
                return i;
            }
        });


        System.out.println("----------------------------------------");

        useRandomNumHandler(() ->{
            Random r = new Random();
            int i = r.nextInt();
            return i;
        });








    }

    public static void useRandomNumHandler (RandomNumHandler randomNumHandler){

        int hand = randomNumHandler.getRandomNm();
        System.out.println(hand);
    }
}
